package com.jtny.nytb.equipment.service;

import com.jtny.component.entity.PageData;
import com.jtny.component.exception.ServiceException;
import com.jtny.nytb.equipment.dto.device.EquipmentInfoDTO;
import com.jtny.nytb.equipment.enums.DataParamImportEnum;
import com.jtny.nytb.equipment.vo.dataparam.LabelVO;
import com.jtny.nytb.equipment.vo.device.*;


import java.util.List;
import java.util.Map;

/**
 * @author 智慧能源中心 - zx
 * @package com.jtny.nytb.energymonitor.equipment.biz
 * @fileName EquipmentInfoBiz.java
 * @createTime 2023年09月20日 09:46
 * @Copyright© 2023 jtny
 * 江投能源技术研究院 版权所有
 */
public interface EquipmentInfoExtraService {
    PageData<EquipmentInfoVO> queryPage(EquipmentInfoQueryPageParamVO equipmentInfoQueryPageParamVO) throws ServiceException;

    EquipmentInfoVO detailsEqu(Long id) throws ServiceException;

    /**
     * 更新设备状态
     *
     * @param id     编号
     * @param status 地位
     */
    void updateEquipmentStatus(Long id, Integer status);

    /**
     * 删除设备 和 设备关联的参量
     *
     * @param id              编号
     * @param deleteDataParam 删除数据参数
     */
    void deleteEquipmentAll(Long id, Boolean deleteDataParam);

    PageData<EquipmentInfoParamVO> queryPageParam(EquipmentInfoParamPageQueryVO equipmentInfoParamPageQueryVO) throws ServiceException;

    EquipmentInfoParamVO savaParam(EquipmentInfoParamVO equipmentInfoParamVO) throws ServiceException;

    void deleteEquParam(Long id) throws ServiceException;

    EquipmentInfoVO detailsEquCode(String code) throws ServiceException;

    /**
     * 创建设备
     *
     * @param equipmentCodeGenerate 设备代码生成
     * @return {@link EquipmentInfoVO}
     */
    EquipmentInfoVO createEquipmentTemp(EquipmentCodeGenerateVO equipmentCodeGenerate);

    /**
     * 通过规则 生成 设备code
     *
     * @param equipmentCodeRule 规则
     * @return {@link EquipmentInfoVO}
     */
    String createEquipmentCodeByRule(Boolean isMeasuringPointDevice, String equipmentCodeRule);

    /**
     * 保存设备 正常操作
     *
     * @param equipmentNormalFormVO 设备基本信息
     */
    void saveEquipment4Normal(EquipmentNormalFormVO equipmentNormalFormVO);

    /**
     * 保存设备 模型操作
     *
     * @param equipmentModelFormVO 设备型号 VO
     */
    void saveEquipment4Model(EquipmentModelFormVO equipmentModelFormVO);

    /**
     * 复制设备
     *
     * @param copyId 复制设备ID
     * @return {@link EquipmentInfoVO}
     */
    EquipmentInfoVO copyEquipment(Long copyId);

    EquipmentInfoVO update(EquipmentInfoVO equipmentInfoVO) throws ServiceException;

    /**
     * 更新设备
     *
     * @param equipmentInfoVO 设备信息 VO
     * @throws ServiceException 服务异常
     */
    void updateEquipment(EquipmentInfoVO equipmentInfoVO) throws ServiceException;

    /**
     * 按设备id 查询设备标签
     *
     * @param equipmentId 设备 ID
     * @return {@link List}<{@link LabelVO}>
     */
    List<LabelVO> listEquipmentLabelByEquipment(Long equipmentId);

//    /**
//     * 保存设备标签
//     *
//     * @param equipmentId 设备 ID
//     * @param labelList   标签列表
//     */
//    void saveEquipmentLabelList(Long equipmentId, List<LabelVO> labelList);
//
//    /**
//     * 删除设备标签
//     *
//     * @param equipmentId 设备 ID
//     * @return {@link //EquipmentModelVO}
//     */
//    void deleteLabel(Long equipmentId, Long labelItemId);


    /**
     * 按名称获取设备信息
     *
     * @param nameList 名称列表
     * @return {@link Map}<{@link String}, {@link EquipmentInfoDTO}>
     */
    Map<String, EquipmentInfoDTO> mapEquipmentByNameList(DataParamImportEnum type, List<String> nameList);

    /**
     * 通过设备上报标识List获取设备
     *
     * @param dockIdentifierList 设备上报标识List
     * @return {@link Map}<{@link String}, {@link EquipmentInfoDTO}>
     */
    Map<String, EquipmentInfoDTO> mapEquipmentByDockIdentifierList(DataParamImportEnum type, List<String> dockIdentifierList);

}
